package com.eqdd.yiqidian.ui.mine.renwu;

import android.view.View;

import com.eqdd.annotation.datasave.DealCodeClass;
import com.eqdd.yiqidian.box.ItemDecoration.SectionDividerItemDecoration;
import com.eqdd.yiqidian.base.CodeRule;
import com.eqdd.yiqidian.base.Config;
import com.eqdd.yiqidian.bean.EnterBean;
import com.eqdd.yiqidian.ui.base.BaseEnterActivity;
import com.eqdd.yiqidian.utils.DensityUtil;
import com.eqdd.yiqidian.utils.ToastUtil;

public class RenwuActivity extends BaseEnterActivity {
    private Class[] classes = new Class[]{
            ShowMyRenwuActivity.class,
            ShowMyCreateRenwuActivity.class,
            ShowMyWithInRenwuActivity.class,
            ShowMyCheckRenwuActivity.class
    };


    @DealCodeClass(classes = {ShowMyRenwuActivity.class})
    public void updateZeren(int num) {
        updateNum(0);
    }

    @DealCodeClass(classes = {ShowMyCreateRenwuActivity.class})
    public void updateFabu(int num) {
        updateNum(1);
    }

    @DealCodeClass(classes = {ShowMyWithInRenwuActivity.class})
    public void updateCanyu(int num) {
        updateNum(2);
    }

    @DealCodeClass(classes = {ShowMyCheckRenwuActivity.class})
    public void updateYanshou(int num) {
        updateNum(3);
    }

    @Override
    public void itemClick(int p) {
        if (classes[p] != null) {
            startActivity(classes[p]);
        } else {
            ToastUtil.showShort(Config.UNDO);
        }
    }

    @Override
    public void initEnterData() {
        isDealCode = true;
        initTopTitleBar(View.VISIBLE, "我的任务");
        initTopRightText("发布任务", v -> {
            startActivity(CreateRenwuActivity.class);
        });
        enterBeans.add(new EnterBean("我的任务").setCode(CodeRule.RENWU_ZERENREN));
        enterBeans.add(new EnterBean("我发布的任务").setCode(CodeRule.RENWU_FAQI));
        enterBeans.add(new EnterBean("我参与的任务").setCode(CodeRule.RENWU_XIEZU_ZHIHUI));
        enterBeans.add(new EnterBean("我验收的任务").setCode(CodeRule.RENWU_YANSHOU));
        dataBinding.recyclerView.addItemDecoration(new SectionDividerItemDecoration(this)
                .setLeftPadding(DensityUtil.percentW(30))
                .setRightPadding(DensityUtil.percentW(30)));

    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
    }
}
